package com.alibaba.csp.sentinel.adapter.dubbo.fallback;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.alibaba.dubbo.rpc.Invocation;
import com.alibaba.dubbo.rpc.Invoker;
import com.alibaba.dubbo.rpc.Result;

/**
 * Fallback handler for Dubbo services.
 */
public interface DubboFallback {

    /**
     * Handle the block exception and provide fallback result.
     *
     * @param invoker    Dubbo invoker
     * @param invocation Dubbo invocation
     * @param ex         block exception
     * @return fallback result
     */
    Result handle(Invoker<?> invoker, Invocation invocation, BlockException ex);
}
